home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Agent Central Host Computer
/
Agent - Central Host Computer.iso
/
_SETUP.1
/
vopenitems.sql
< prev
next >
Wrap
Text File
|
2000-05-12
|
2KB
|
57 lines
/*
This view collects the 3 types of open items. Type 1 is counts and probes that have been matched but not closed. Type 2 is probes that are not matched to a count and type 3 is counts that are not matched to a probe.
*/
CREATE OR REPLACE VIEW VOPENITEMS AS
SELECT
'1' type, PRPEND.PRPEND_INDX, PRPEND.FAREBOX_GLID, PRPEND.CASHBOX_GLID,
PRPEND.CBREMOV_DATE, PRPEND.BILL_TOTALS, PRPEND.COIN_TOTALS,
PRPEND.TOT_AMOUNT, PRPEND.SUBBATCH_SEQ, MRR.COIN_TOTAL_VALUE,
MRR.BILL_TOTAL, MRR.GRAND_TOTAL, MRR.COUNT_DATE,
MRR.ADJ_GRAND_TOTAL, bus.bus_id ,
sign( (abs(MRR.ADJ_GRAND_TOTAL - PRPEND.TOT_AMOUNT) / MRR.ADJ_GRAND_TOTAL)- match.tolerance) OutOfBalance,
0 missing, match.tolerance, match.errhours
FROM
bus bus,
farebox fbo,
PRPEND PRPEND,
VMRRECONCILE MRR,
matchconfig match
WHERE
PRPEND.FAREBOX_GLID = fbo.glid and
fbo.location = bus.glid and
( PRPEND.PRPEND_INDX=MRR.PRPEND_INDX ) AND
( PRPEND.SUBBATCH_SEQ=MRR.SUBBATCH_SEQ )
union
SELECT
'2' type, PRPEND.PRPEND_INDX, PRPEND.FAREBOX_GLID, PRPEND.CASHBOX_GLID,
PRPEND.CBREMOV_DATE, PRPEND.BILL_TOTALS, PRPEND.COIN_TOTALS,
PRPEND.TOT_AMOUNT, PRPEND.SUBBATCH_SEQ, 0 COIN_TOTAL_VALUE,
0 BILL_TOTAL, 0 GRAND_TOTAL, sysdate COUNT_DATE,
0 ADJ_GRAND_TOTAL , bus.bus_id , 0 outofbalance,
sign( ( sysdate - PRPEND.CBREMOV_DATE) - (match.errhours /24.00)) missing,
match.tolerance, match.errhours
FROM
bus bus,
farebox fbo,
PRPEND PRPEND,
matchconfig match
WHERE
PRPEND.FAREBOX_GLID = fbo.glid and
fbo.location = bus.glid and
( PRPEND.SUBBATCH_SEQ = 0 )
union
SELECT
'3' type, 0 PRPEND_INDX, 0 FAREBOX_GLID, MRR.CASHBOX_GLID,
sysdate CBREMOV_DATE, 0 BILL_TOTALS, 0 COIN_TOTALS,
0 TOT_AMOUNT, MRR.SUBBATCH_SEQ, MRR.COIN_TOTAL_VALUE,
MRR.BILL_TOTAL, MRR.GRAND_TOTAL, MRR.COUNT_DATE,
MRR.ADJ_GRAND_TOTAL , 0 bus_id , 0 outofbalance, 0 missing ,
match.tolerance, match.errhours
FROM
VMRRECONCILE MRR,
matchconfig match
WHERE
( MRR.PRPEND_INDX = 0);